/*
 *  Copyright 2009 Coditate Software
 *  Licensed under the GNU Library General Public License (LGPL) 2.1 
 *  
 *  License available at: http://simplesavant.codeplex.com/license
 */
using System;
using System.Reflection;
using Coditate.Common.Util;

namespace Coditate.Savant.Core
{
    /// <summary>
    /// Holds mapping metadata about persistent item properties used with Savant.
    /// </summary>
    internal class TypeAttributeMapping : AttributeMapping
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeAttributeMapping"/> class.
        /// </summary>
        /// <param name="property">The property.</param>
        public TypeAttributeMapping(PropertyInfo property)
        {
            Arg.CheckNull("property", property);

            Property = property;
            PropertyName = Property.Name;
            PropertyType = Property.PropertyType;
        }

        [Obsolete]
        public override object GetValue(object propertyHolder)
        {
            throw new NotSupportedException();
        }

        [Obsolete]
        public override void SetValue(object propertyHolder, object value)
        {
            throw new NotSupportedException();
        }

        public PropertyInfo Property { get; private set; }

        public override string FullPropertyName
        {
            get { return Property.DeclaringType.FullName + "." + Property.Name; }
        }
    }
}